export default {
  getCookie (name) {
    var aCookie = document.cookie.split('; ')
    for (var i = 0; i < aCookie.length; i++) {
      var aCrumb = aCookie[i].split('=')
      if (name === aCrumb[0]) {
        return unescape(aCrumb[1])
      }
    }
    return null;
  },
  delCookie (name) {
    var exp = new Date()
    exp.setTime(exp.getTime() - 1)
    document.cookie = name + '=' + '' + ';expires=' + exp.toGMTString()
  },
  setCookie (name, value, expHours) {
    var exp = new Date()
    exp.setTime(exp.getTime() + expHours * 60 * 60 * 1000)
    document.cookie = name + '=' + escape(value) + ';expires=' + exp.toGMTString()
  }
}
